﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InsClassCount.aspx.cs" Inherits="InsClassCount" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>巡检分类统计</title>
    <script src="../js/extTools.js" type="text/javascript"></script>
    <link href="../css/ExtStyle.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery/jquery-3.2.1.min.js" type="text/javascript"></script>

    <style type="text/css">
        .custom_hide_0
        {
            display:none;
        }
    </style>

    <script type="text/javascript">

        var btnTabPage = function () {
            //console.log(App.TabPanel1);
            //console.log(App.TabPanel1.activeTab.id);
            if (App.TabPanel1.activeTab.id == "GridPanel1") {
                Ext.getCmp("TxtStoreManager").show();
                Ext.getCmp("TxtParentName").show();
            }
            else {
                Ext.getCmp("TxtStoreManager").hide();
                Ext.getCmp("TxtParentName").hide();
            }
        }

        //问题详情 
        var btnProblemDetail_Click = function (tif_id) {
            //alert(tif_id);
            App.winMain.setTitle('问题列表');
            App.winMain.show();
            CompanyX.GetProblemDetails(tif_id);
        }

        //查看问题店铺名称 
        var btnProblemShopDetail_Click = function (ins_id, ins_checkContext)
        {
            App.winShop.setTitle('店铺列表' + '' + ins_checkContext + '');
            App.winShop.show();
            CompanyX.GetProblemShopDetail(ins_id);
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Neptune" />
            <ext:Viewport ID="Viewport1" runat="server">
                <LayoutConfig>
                    <ext:HBoxLayoutConfig Align="Stretch" />
                </LayoutConfig>
                <Defaults>
                    <ext:Parameter Name="margin" Value="2 0" Mode="Value" />
                </Defaults>
                <Items>
                    <ext:TabPanel ID="TabPanel1" runat="server" Flex="1">
                        <TopBar>
                            <ext:Toolbar ID="Toolbar1" runat="server" Layout="ColumnLayout">
                                <Items>
                                    <ext:ComboBox runat="server" ID="OperationAreaName" DisplayField="OperationAreaName" QueryMode="Local" TypeAhead="true" ValueField="OperationAreaName" Width="180" FieldLabel="分部" LabelWidth="35">
                                        <Store>
                                            <ext:Store ID="Store2" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model2" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="OperationAreaName" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                        <DirectEvents>
                                            <Change OnEvent="GetBigAreaName" />
                                        </DirectEvents>
                                    </ext:ComboBox>

                                    <ext:ComboBox runat="server" ID="txtBigAreaName" DisplayField="BigAreaName" QueryMode="Local" TypeAhead="true" ValueField="BigAreaName" Width="180" FieldLabel="省份" LabelWidth="35">
                                        <Store>
                                            <ext:Store ID="Store_BigAreaName" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model6" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="BigAreaName" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                        <DirectEvents>
                                            <Change OnEvent="GetArea" />
                                        </DirectEvents>
                                    </ext:ComboBox>

                                    <ext:ComboBox runat="server" ID="txtAreaName" DisplayField="AreaName" QueryMode="Local" TypeAhead="true" ValueField="AreaName" Width="180" FieldLabel="城市" LabelWidth="35">
                                        <Store>
                                            <ext:Store ID="Store_AreaName" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model7" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="AreaName" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                    </ext:ComboBox>

                                    <ext:ComboBox runat="server" ID="TxtStoreManager" DisplayField="tif_shopManager" QueryMode="Local" TypeAhead="true" ValueField="tif_shopManager" Width="160" FieldLabel="店经理" LabelWidth="45">
                                        <Store>
                                            <ext:Store ID="tif_shopManager" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model8" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="tif_shopManager" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                    </ext:ComboBox>

                                    <ext:ComboBox runat="server" ID="TxtParentName" DisplayField="ins_parentShortName" QueryMode="Local" TypeAhead="true" ValueField="ins_parentCode" Width="160" FieldLabel="巡检类别" LabelWidth="60">
                                        <Store>
                                            <ext:Store ID="ins_parentShortName" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model1" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="ins_parentShortName" />
                                                            <ext:ModelField Name="ins_parentCode" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                    </ext:ComboBox>

                                    <ext:DateField runat="server" ID="txtTimeBegin" LabelWidth="60" Editable="false" FieldLabel="巡检时间" Width="180" />
                                    <ext:DateField runat="server" ID="txtTimeEnd" LabelWidth="20" Editable="false" FieldLabel="至" Width="180" />

                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <Items>
                            <ext:GridPanel ID="GridPanel1" runat="server" Title="类别统计" TitleAlign="Right" Height="500" Icon="Find">
                                <Store>
                                    <ext:Store ID="Store1" runat="server" PageSize="40" OnReadData="RefreshDataSet">
                                        <Model>
                                            <ext:Model ID="Model3" runat="server" IDProperty="类别统计编号">
                                                <Fields>
                                                    <ext:ModelField Name="Num" />
                                                    <ext:ModelField Name="tif_shopName" />
                                                    <ext:ModelField Name="ins_score" />
                                                    <ext:ModelField Name="tid_points" />
                                                    <ext:ModelField Name="ProblemNum" />
                                                    <ext:ModelField Name="tif_id" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel>
                                    <Columns>
                                        <%--<ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" />--%>
                                        <ext:Column ID="Column1" runat="server" Text="排名" DataIndex="Num" Width="100" />
                                        <ext:Column ID="Column2" runat="server" Text="店铺" DataIndex="tif_shopName" Width="220" />
                                        <ext:Column ID="Column3" runat="server" Text="总分" DataIndex="ins_score" Width="100" />
                                        <ext:Column ID="Column4" runat="server" Text="得分" DataIndex="tid_points" Width="100" />
                                        <ext:Column ID="Column5" runat="server" Text="问题数" DataIndex="ProblemNum" Width="100" />
                                        <ext:TemplateColumn ID="Column8" runat="server" Text="问题详情" DataIndex="ProblemDetails" TemplateString='<a href=# class="custom_hide_{ProblemNum}" onclick=btnProblemDetail_Click("{tif_id}")>查看</a>' />
                                    </Columns>
                                </ColumnModel>

                                <BottomBar>
                                    <ext:PagingToolbar ID="PagingToolbar1" runat="server">
                                        <Items>
                                            <ext:Label ID="Label1" runat="server" Text="每页显示:" />
                                            <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
                                            <ext:ComboBox ID="ComboBox1" runat="server" Width="80">
                                                <Items>
                                                    <ext:ListItem Text="500" />
                                                </Items>
                                                <SelectedItems>
                                                    <ext:ListItem Value="500" />
                                                </SelectedItems>
                                                <Listeners>
                                                    <Select Handler="#{GridPanel1}.store.pageSize = parseInt(this.getValue(), 10); #{GridPanel1}.store.reload();" />
                                                </Listeners>
                                            </ext:ComboBox>
                                            <ext:Button ID="Button1" runat="server" Text="查询" Width="70" OnDirectClick="BtnQureyTypeCount" UI="Info" Icon="Find">
                                                <DirectEvents>
                                                    <Click Timeout="300000">
                                                        <EventMask ShowMask="true" Msg="加载中..."></EventMask>
                                                    </Click>
                                                </DirectEvents>
                                            </ext:Button>
                                            <ext:Button ID="Button9" runat="server" Text="导出Excel" OnDirectClick="BtnTypeCountOutExcel" Visible="true" UI="Info" Icon="PageExcel">
                                            <DirectEvents>
                                                <Click Timeout="300000">
                                                    <EventMask ShowMask="true" Msg="玩命下载中...">
                                                    </EventMask>
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        </Items>
                                        <Plugins>
                                            <ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
                                        </Plugins>
                                    </ext:PagingToolbar>
                                </BottomBar>
                            </ext:GridPanel>

                            <ext:GridPanel ID="GridPanel2" runat="server" Title="小类统计" TitleAlign="Right" Height="500" Icon="Find">
                                <Store>
                                    <ext:Store ID="Store3" runat="server" PageSize="40" OnReadData="RefreshMinDataSet">
                                        <Model>
                                            <ext:Model ID="Model4" runat="server" IDProperty="小类统计编号">
                                                <Fields>
                                                    <ext:ModelField Name="Num" />
                                                    <ext:ModelField Name="ins_parentShortName" />
                                                    <ext:ModelField Name="ins_checkContext" />
                                                    <ext:ModelField Name="ProblemShopNum" />
                                                    <ext:ModelField Name="ProportionNum" />
                                                    <ext:ModelField Name="ins_id" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel>
                                    <Columns>
                                        <%--<ext:RowNumbererColumn ID="RowNumbererColumn2" runat="server" />--%>
                                        <ext:Column ID="Column6" runat="server" Text="排名" DataIndex="Num" Width="50" />
                                        <ext:Column ID="Column7" runat="server" Text="类别" DataIndex="ins_parentShortName" Width="90" />
                                        <ext:Column ID="Column9" runat="server" Text="小类" DataIndex="ins_checkContext" Flex="1" />
                                        <ext:Column ID="Column10" runat="server" Text="问题店铺总计" DataIndex="ProblemShopNum" Width="100" />
                                        <ext:Column ID="Column11" runat="server" Text="占比" DataIndex="ProportionNum" Width="70" />
                                        <ext:TemplateColumn ID="TemplateColumn1" runat="server" Text="问题店铺" DataIndex="ins_id" TemplateString='<a href=# onclick=btnProblemShopDetail_Click("{ins_id}","")>查看</a>' />
                                    </Columns>
                                </ColumnModel>

                                <BottomBar>
                                    <ext:PagingToolbar ID="PagingToolbar2" runat="server">
                                        <Items>
                                            <ext:Label ID="Label2" runat="server" Text="每页显示:" />
                                            <ext:ToolbarSpacer ID="ToolbarSpacer2" runat="server" Width="10" />
                                            <ext:ComboBox ID="ComboBox2" runat="server" Width="80">
                                                <Items>
                                                    <ext:ListItem Text="500" />
                                                </Items>
                                                <SelectedItems>
                                                    <ext:ListItem Value="500" />
                                                </SelectedItems>
                                                <Listeners>
                                                    <Select Handler="#{GridPanel2}.store.pageSize = parseInt(this.getValue(), 10); #{GridPanel2}.store.reload();" />
                                                </Listeners>
                                            </ext:ComboBox>
                                            <ext:Button ID="Button2" runat="server" Text="查询" Width="70" OnDirectClick="BtnQureyMinTypeCount" UI="Info" Icon="Find">
                                                <DirectEvents>
                                                    <Click Timeout="300000">
                                                        <EventMask ShowMask="true" Msg="加载中..."></EventMask>
                                                    </Click>
                                                </DirectEvents>
                                            </ext:Button>
                                            <ext:Button ID="Button3" runat="server" Text="导出Excel" OnDirectClick="BtnMinTypeCountOutExcel" Visible="true" UI="Info" Icon="PageExcel">
                                            <DirectEvents>
                                                <Click Timeout="300000">
                                                    <EventMask ShowMask="true" Msg="玩命下载中...">
                                                    </EventMask>
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        </Items>
                                        <Plugins>
                                            <ext:ProgressBarPager ID="ProgressBarPager2" runat="server" />
                                        </Plugins>
                                    </ext:PagingToolbar>
                                </BottomBar>
                            </ext:GridPanel>
                        </Items>
                        <Listeners>
                            <TabChange Handler="btnTabPage();" />
                        </Listeners>
                    </ext:TabPanel>
                </Items>
            </ext:Viewport>

            <ext:Window runat="server" ID="winMain" Icon="DatabaseAdd" Hidden="true" Constrain="true" MinHeight="500" MaxHeight="500" MinWidth="840" Modal="true" CloseAction="Hide" BodyPaddingSummary="10" Layout="FitLayout">
                <Items>
                    <ext:FormPanel runat="server" AutoScroll="true" ID="frmMain" Layout="VBoxLayout">
                        <FieldDefaults LabelAlign="Left" LabelWidth="60" MsgTarget="Side" />
                        <Plugins>
                            <ext:DataTip ID="DataTip1" runat="server" />
                        </Plugins>
                        <LayoutConfig>
                            <ext:VBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
                            <ext:GridPanel ID="GridPanelBatch" runat="server">
                                <Store>
                                    <ext:Store ID="ProblemList" runat="server">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="问题列表">
                                                <Fields>
                                                    <ext:ModelField Name="Num" />
                                                    <ext:ModelField Name="ins_checkContext" />
                                                    <ext:ModelField Name="ins_score" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel>
                                    <Columns>
                                        <%--<ext:RowNumbererColumn ID="RowNumbererColumn3" runat="server" />--%>
                                        <ext:Column ID="BatchColumn2" runat="server" Text="序号" DataIndex="Num" Width="50" />
                                        <ext:TemplateColumn ID="TemplateColumn2" runat="server" Text="问题内容" Width="760" Flex="1" DataIndex="ins_checkContext" TemplateString='{ins_checkContext}(<span style="color:#FF0000;">{ins_score}分</span>)' />
                                    </Columns>
                                </ColumnModel>
                            </ext:GridPanel>
                        </Items>
                    </ext:FormPanel>
                </Items>
            </ext:Window>

            <ext:Window runat="server" ID="winShop" Icon="DatabaseAdd" Hidden="true" Constrain="true" MinHeight="500" MaxHeight="500" MinWidth="550" Modal="true" CloseAction="Hide" BodyPaddingSummary="10" Layout="FitLayout">
                <Items>
                    <ext:FormPanel runat="server" AutoScroll="true" ID="FormPanel1" Layout="VBoxLayout">
                        <FieldDefaults LabelAlign="Left" LabelWidth="60" MsgTarget="Side" />
                        <Plugins>
                            <ext:DataTip ID="DataTip2" runat="server" />
                        </Plugins>
                        <LayoutConfig>
                            <ext:VBoxLayoutConfig Align="Stretch" />
                        </LayoutConfig>
                        <Items>
                            <ext:GridPanel ID="GridPanel3" runat="server">
                                <Store>
                                    <ext:Store ID="Store4" runat="server">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="店铺列表">
                                                <Fields>
                                                    <ext:ModelField Name="Num" />
                                                    <ext:ModelField Name="tif_shopName" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel>
                                    <Columns>
                                        <ext:Column ID="Column12" runat="server" Text="序号" DataIndex="Num" Width="60" />
                                        <ext:Column ID="Column13" runat="server" Text="扣分店铺" DataIndex="tif_shopName" Width="460" Flex="1" />
                                    </Columns>
                                </ColumnModel>
                            </ext:GridPanel>
                        </Items>
                    </ext:FormPanel>
                </Items>
            </ext:Window>

            <ext:Hidden ID="TxtParentName1" runat="server" ClientIDMode="Static" Text="" />

            <ext:Hidden ID="txtAreaName1" runat="server" ClientIDMode="Static" Text="" />
            <ext:Hidden ID="txtBigAreaName2" runat="server" ClientIDMode="Static" Text="" />
            <ext:Hidden ID="OperationAreaName3" runat="server" ClientIDMode="Static" Text="" />
            <ext:Hidden ID="txtTimeBegin4" runat="server" ClientIDMode="Static" Text="" />
            <ext:Hidden ID="txtTimeEnd5" runat="server" ClientIDMode="Static" Text="" />

        </div>
    </form>
</body>
</html>
